package com.northone.statistics.fragment;

import com.northone.statistics.R;
import com.northone.statistics.doman.WeekData;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class WeekTwoFragment extends WeekFragment {
	private WeekData weekData = new WeekData();

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		view = inflater.inflate(R.layout.fragment_week, container, false);
		initView();
		initData();
		if (isShowData) {
			showWeekData(weekData);
		}
		if (activity.isUpdate) {
			setWeekData(1);
		}
		weekTitle.setText(R.string.two_week);
		return view;
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_lastWeek:
			activity.vp_week.setCurrentItem(0, true);
			break;
		case R.id.btn_nextWeek:
			activity.vp_week.setCurrentItem(2, true);
			break;
		case R.id.btn_save:
			isShowData = saveWeekData(weekData, 1);
			break;
		case R.id.btn_edit:
			editWeekInfo(weekData, 1);
			break;
		case R.id.btn_clear:
			clearData();
			break;
		default:
			break;
		}
	}
}
